package com.zdkj.subway.stm.fegin;

import com.zdkj.admin.api.dto.UserInfo;
import com.zdkj.admin.api.entity.SysDept;
import com.zdkj.admin.api.entity.SysDictItem;
import com.zdkj.admin.api.entity.SysUser;
import com.zdkj.common.core.constant.SecurityConstants;
import com.zdkj.common.core.constant.ServiceNameConstants;
import com.zdkj.common.core.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;

/**
 * @author cuilei
 * @program: zdkj
 * @description:
 * @create 2020-02-14 15:50
 */
@FeignClient(contextId = "systemUserService", value = ServiceNameConstants.UPMS_SERVICE)
public interface SystemUserService {
    /**
     * 查询当前登录系统用户详细信息
     * @return
     */
    @GetMapping("/user/info")
    R<UserInfo> info();

    /**
     * 根据用户名查询用户信息
     * @param username
     * @return
     */
    @GetMapping("/user/details/{username}")
    R<SysUser> user(@PathVariable("username") String username);

    /**
     * 根据用户名查询用户的详细信息
     * @param username
     * @param from
     * @return
     */
    @GetMapping("/user/info/{username}")
    R<UserInfo> info(@PathVariable("username") String username,
                     @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 根据部门id查询部门信息
     * @param id
     * @param from
     * @return
     */
    @GetMapping("/dept/{id}")
    R<SysDept> deptInfo(@PathVariable("id") Integer id,
                        @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 根据字典类型查询字典信息
     */
    @GetMapping("/dict/type/{type}")
    R<List<SysDictItem>> getDictByType(@PathVariable("type") String type);

    @GetMapping("/dict/typeOrderBy/{type}")
    R<List<SysDictItem>> typeOrderBy(@PathVariable("type") String type);
}
